import type { RouteRecordRaw } from 'vue-router';
import {Layout} from "@/router/constant";
import {renderIcon} from "@/utils";
import {ApiOutlined} from "@vicons/antd";

const openRoutes: RouteRecordRaw[] = [
  {
    path: '/openness',
    name: 'Openness',
    meta: {
      title: '开放能力',
      icon: renderIcon(ApiOutlined),
      permissions: ['api-auth', 'api-docs', 'passwordless-login'],
      sort: 7,
    },
    redirect: '/openness/api-auth',
    component: Layout,
    children: [
      {
        path: 'api-auth',
        name: 'ApiAuth',
        component: () => import('@/views/openness/api-auth/index.vue'),
        meta: {
          title: '接口授权',
          permissions: ['api-auth'],
        }
      },
      {
        path: 'api-docs',
        name: 'ApiDocs',
        component: () => import('@/views/openness/api-docs/index.vue'),
        meta: {
          title: '接口文档',
          permissions: ['api-docs'],
        }
      },
      {
        path: 'passwordless-login',
        name: 'PasswordlessLogin',
        component: () => import('@/views/openness/passwordless-login/index.vue'),
        meta: {
          title: '免密码登录',
          permissions: ['passwordless-login'],
        }
      }
    ]
  }
];

export default openRoutes;
